<%@page import="Entities.*"%>
<%@page import="Helpers.*"%>
<%@page import="Hibernate.*"%>
<%@page import="java.util.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Rols</title>
    </head>
    <body>
        <table border="1">
            <%
        String naam = (String) request.getParameter("naam");
        //show form
        if (naam == null) {
            %>
            <h1>Voeg rol toe:</h1> <br />

            <form name="addRol" action="addRol.jsp" method="POST">
                Naam: <input type="text" name="naam" value="" /> <br />
                <input type="submit" value="Add" />
            </form>
            <%
        //persist rol
        } else {
            // 2 instances aanmaken van de Helpers die we nodig hebben
            RollenHelper helperRol = new RollenHelper();

            Rollen rol = new Rollen();

            rol.setNaam((String) request.getParameter("naam"));
            helperRol.persistRol(rol);

            response.sendRedirect("showRollen.jsp");
        }
            %>
        </table>
    </body>
</html>